﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace XrmLibrary.MsCrm4Adapter.Extensions
{
    public static class SecurityPrincipalExtensions
    {
        public static Microsoft.Xrm.Sdk.EntityReference ToEntityReference(this Microsoft.Crm.Sdk.SecurityPrincipal securityPrincipal)
        {
            Microsoft.Xrm.Sdk.EntityReference entityReference =
                new Microsoft.Xrm.Sdk.EntityReference
                {
                    Id = securityPrincipal.PrincipalId,
                    LogicalName = securityPrincipal.Type.ToStringExtended()
                };

            return entityReference;
        }
    }
}
